package job3;

public class Main {
    public static void main(String[] args) {
//        创建火车票类，指定剩余100张火车票
        TrainTickets trainTickets = new TrainTickets(100);
//        继承thread 实现方式，1秒钟卖5张票
        SaleThread saleThread = new SaleThread(trainTickets, "售卖员小明", 200);
//        继承thread 实现方式，1秒钟卖2张票
        SaleThread saleThread2 = new SaleThread(trainTickets, "售卖员小军", 500);
//        通过runnable接口，1秒钟卖1张票
        Thread saleThread3 = new Thread(new SaleRunnable(trainTickets, "售卖员小张", 1000));
//        启动3个卖票线程
        saleThread3.start();
        saleThread2.start();
        saleThread.start();
    }
}


